\documentclass[12pt]{amsbook}
\usepackage{hyperref,jpmacros,mathmacros}

\begin{document}

\title{\bfseries Comparing Data With Theoretical Distributions Using R and rdistplotter}
\author{\bfseries\small Jason Pol\'ak}
\maketitle

\chapter{Distribution Theory}
We may classify distributions into three types: discrete, continous, and mixed. A mixed distribution has a cumulative distribution function that is continuous with a nonzero derivative at at least one point, and also has discontinous steps representing a positive probability concentrated at a single point.

We shall not consider this more complicated type of distribution. The first two, discrete and continous, will be discussed briefly.

\section{Discrete Distributions}

\section{Continuous Distributions of the Exponential Family}
The exponential family of distributions is defined to contain distributions whose density function are of the form:

\begin{equation}
	(exp here)
\end{equation}

and no others.

\subsection{Uniform Distributon}\label{unif}
The uniform distribution has a constant density function:

\begin{equation}
	f(x) = \left\{
	\begin{array}{l l}
		\frac{1}{b-a} & \text{for }x\in [a,b]\\
		0 & \text{for }x\not\in [a,b]
	\end{array}\right.
\end{equation}

With the parameters $a,b\in\R$ where $a < b$. If we take $n$ independent samples from this distribution: $x_1,\dots,x_n$, then the likelihood function at this vector is:

\begin{equation}
	f(x_1,\dots,x_n) = \frac{1}{(b-a)^n}\cdot I(x_1,\dots,x_n > a)I(x_1,\dots,x_n < b)
\end{equation}

Thus to maximize this function, $b-a$ must be made as small as possible whilst still containing all such samples in order to have the indicator functions be unity. Hence we take $a=\min\{ x_i\}$ and $b=\max\{x_i\}$. So $(\min \{ x_i\},\max \{x_i\})$ is the maximum likelihood estimator of $(a,b)$.

\subsection{Normal Distribution}\label{normal}
The normal distribution or Gaussian distribution has the density function:

\begin{align*}
	f(x) = \frac{1}{\sqrt{2\pi\sigma}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}
\end{align*}

And the corresponding joint density function for an i.i.d. sample of size $n$ is:

\section{Other Distributions}

\section{Theoretical Order Statistics}

\chapter{Comparison Methods}
\section{Linear Model On Order Statistics}
Suppose we have a sample $x_1,\dots,x_n$ from some distribution. Then we may reorder the sample: $y_1,\dots,y_n$ where $y_1 < y_2 < \dots < y_n$, and compare this sample to the theoretical quantiles from a distribution that we believe may be the underlying distribution of the data. This is known as a quantile-quantile or QQ plot and is very common for data comparison.

Often these plots are produced to compare against the normal distribution but we may use this technique for any distribution. There are two ways to generate the theoretical quantiles: using a random number generator to estimate these or to derive them theoretically. The latter is preferred, although naturally there are cases where the derivation is not known or very complicated.

\begin{exmp}
	On a Linux system, the {\tt /usr/bin} directory contains hundreds of programs. In a terminal emulator the command {\tt time ls} was used to list the contents of that directory on the dear author's machine. The times were recorded and this experiment was repeated $35$ times under similar conditions.
\end{exmp}

\chapter{Directory of Functions}

\end{document}
